<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="exChange"></div>
    <script>
        var time = new Date("2021-7-27 08:30:00").getTime();
        // 倒计时
        function run() {
            var nowTime = new Date().getTime();
            var stime = (time - nowTime) / 1000;  // 得到的是 明天距离今天的毫秒数
            // console.log(stime/3600);
            var day = parseInt(stime / 3600 / 24);  // 天
            // console.log(day);
            var hour = parseInt(stime / 3600 - day * 24); //时
            // console.log(hour)
            var minute = parseInt(stime / 60 - hour * 60 - day * 24 * 60); //分
            // console.log(minute);
            var second = parseInt(stime % 60);
            // console.log(second);
            document.getElementsByClassName("exChange")[0].innerHTML = day + "天" + hour + "小时" + minute + "分" + second + "秒";
        }
        setInterval(run, 10);






    </script>
</body>

</html>